package net.zjitc.service.impl;

import net.zjitc.dao.ProductDao;
import net.zjitc.dao.impl.ProductDaoImpl;
import net.zjitc.domain.Product;
import net.zjitc.service.ProductService;

import java.sql.SQLException;
import java.util.List;

/**
 * @Author admin
 * @Date 2019/2/25 10:47
 */
public class ProductServiceImpl implements ProductService {
    ProductDao dao = new ProductDaoImpl();

    @Override
    public List<Product> findAll() throws SQLException {
        return dao.findAll();
    }

    @Override
    public void add(Product p) throws SQLException {
        ProductDaoImpl productDao = new ProductDaoImpl();
        productDao.add(p);
    }

    @Override
    public void delete(String pid) throws SQLException {
        dao.delete(pid);
    }

    @Override
    public void update(Product product,String pid) throws SQLException {
        dao.update(product,pid);
    }

    @Override
    public Product fingById(String pid) throws SQLException {
        return dao.fingById(pid);
    }
}
